<?php

	class cms_article_model extends st_model {
		protected $_instance  = array(
										  'table'      => 'cms_article', 
										  'primaryKey' => 'id',
									  );
									  
		public function getArticleUrl() 
		{
			return site_url('admin/cms/article/edit/id/' . $this->getId(), true);
		}
		
		public function getIndexUrl($param = '') 
		{
			return site_url() . '/admin/cms/article/index/' . $param;
		}
		
		public function getCategory()
		{
			if (!$this->isLoaded()) {
				return null;
			}
			$this->load->model('cms_scategory_model');
			$this->cms_category_model->loadByPK($this->getCategoryId());
			return $this->cms_category_model;
		}
		
		public function getThumbUrl()
		{
			if (!$this->isLoaded()) {
				return null;
			}
			$url = base_url() . substr($this->getThumbImage(), 1, strlen($this->getThumbImage()));
			return $url;
		}
	}	
?>